package com.servlet.users;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.UsersDAO;

public class DelectUsersByIdServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		int userId = Integer.parseInt(request.getParameter("user_id"));
		UsersDAO usersDAO = new UsersDAO();//得到DAO对象
		if (usersDAO.delectById(userId)) {
			request.getRequestDispatcher("/servlet/FindAllUsersServlet").forward(
					request, response);
			return;
		}
		

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		int userId = Integer.parseInt(request.getParameter("user_id"));
		UsersDAO usersDAO = new UsersDAO();//得到DAO对象
		if (usersDAO.delectById(userId)) {
			request.getRequestDispatcher("/servlet/FindAllUsersServlet").forward(
					request, response);
			return;
		}
		

	}

}
